Ccay.Module.define("Ccay.example.ui.simpleflow",function(page,$S){
	page.ready=function(){
		
			$S("#simpleflowDemo").ccayTab({
			
				fnOnceSelectItem:function(tabid){
					if(tabid == "tab2"){
						var op1 = {
								template:$S("#template1").text(),
								processInstanceId : 151007,
								nodes: [
								       {name:"提交",text:"",status:"ready",users:[{handlerName:"test1",type:"u"}],date:"2013-12-1 08:00"},
								  	   {name:"XXX审批",text:"",status:"ready",users:[{handlerName:"linshijian 00195395",type:"u"},{handlerName:"test1",type:"u"},{handlerName:"test2",type:"u"},{handlerName:"Ccay_VVIP",type:"g"},{handlerName:"Ccay_VIP",type:"g"}],date:"2013-12-1 10:00"},
								       {name:"XXX审批",text:"",status:"doing",users:[{handlerName:"test5",type:"u"}],date:""},
								       {name:"XXX审批",text:"",status:"wait",users:[{handlerName:"test1",type:"u"}],date:""},
								       {name:"完成",text:"",status:"wait",users:"",date:""}
								]
						};
						$("#simpleFlow1").ccaySimpleFlow(op1);
					}else if(tabid == "tab3"){
						var op2 = {
								type:"timeline", // 重要！！！必须设置
								//sortFormat:"yyyy/MM/dd", // 分组格式，与dateFormat配合使用,无配置时，系统默认的年月日格式
								//dateFormat:"hh:mm", // 子节点的日期显示，默认系统的时分格式
								//dateName:"date", // 重要！！！指定时间字段，默认为"date"
								//asc:true, // 默认降序，true升序, 默认false降序
								//template:$("#template3").val(),
								templateName: "simpleflowDemo", // 必须设置   指定富文本配置的TimelineTemplate的模板名称
								nodes: [
								       {name:"1",text:"",status:"ready",users:[{handlerName:"test1",type:"u"}],date:"2013-05-01 08:00"},
								  	   {name:"2",text:"",status:"ready",users:[{handlerName:"linshijian 00195395",type:"u"},{handlerName:"test1",type:"u"},{handlerName:"test2",type:"u"},{handlerName:"Ccay_VVIP",type:"g"},{handlerName:"Ccay_VIP",type:"g"}],date:"2013-05-01 07:00"},
								       {name:"3",text:"",status:"doing",users:[{handlerName:"test5",type:"u"}],date:"2013-05-01 06:00"},
								       {name:"4",text:"",status:"wait",users:[{handlerName:"test1",type:"u"}],date:"2013-05-02 05:00"},
								       {name:"5",text:"",status:"wait",users:"",date:"2013-05-02 04:00"}
								]
						};
						$("#simpleFlow2").ccaySimpleFlow(op2);
					}
				}
			});
	}

})


